import 'package:flutter/material.dart';
import 'package:flutter_provider_demo/provide/counter_view_model.dart';

import 'package:provider/provider.dart';

import 'provide/counter_operation_view.dart';
import 'provide/counter_view.dart';

void main() {
  runApp(const CounterApp());
}

class CounterApp extends StatelessWidget {
  const CounterApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    /// Provider
    return ChangeNotifierProvider(
      create: (_) => CounterViewModel(),
      child: MaterialApp(
        title: 'Provider',
        initialRoute: "/counter",
        routes: {
          '/counter': (context) => const CounterView(),
          '/counter_operation': (context) => const CounterOperationView(),
        },
      ),
    );
  }
}
